/// \file CTimer.h
/// \author A. Dechambenoit (andreas.dechambenoit@gmail.com)
/// \date 
///
/// \brief Class for the time management
///
#ifndef __CTIMER_H__
#define __CTIMER_H__

#include <windows.h>
#include <boost/smart_ptr/shared_ptr.hpp>

static const float g_f_timerDefault_Fps=60.0f;


class CDXEngineTimer
{
public:
					CDXEngineTimer();
	virtual			~CDXEngineTimer();

	bool			Tick();
	void			SetFPSLock(float fFrameperSecond = g_f_timerDefault_Fps);
	float			getTimeElapsed();
	float			getCurTime();

protected:
	bool			HwTick();
	bool			SwTick();
	float			getSwTimeElapsed();
	float			getHwTimeElapsed();
	void			resetTimer();
	bool			isHardwareTimer();

private:
	bool			m_PerfHardware;
	float			m_TimeScale;

	LARGE_INTEGER	m_HwCurrentTime;	
	LARGE_INTEGER	m_HwLastTime;
	DWORD			m_SwLastTime;
	DWORD			m_SwCurrentTime;
	float			m_TimePerFrame;
};
typedef boost::shared_ptr<CDXEngineTimer> DXEngineTimerPtr;

#endif // __CTIMER_H__